package com.example.qrcodelibrary.Utils;

public enum ErrorCodeEnum implements ErrorCode {

    //异常枚举 列表
    UNSPECIFIED("zyfError01","未定义异常"),
    //Data is empty  数据为空
    Data_is_empty("zyfError01",""),
    //串口未初始化 请先初始化
    SERIAL_PORT_NOT_INITIALIZED("zyfError10","串口未初始化,请先初始化");


    /**
     * 描述
     */
    private String description;
    private String code;

    ErrorCodeEnum(String description,String code) {
        this.description = description;
        this.code = code;
    }

    public static ErrorCodeEnum getAnnotation(String code){
        for (ErrorCodeEnum value : ErrorCodeEnum.values()) {
            if (value.equals(code)) {
                return value;
            }
        }
        return UNSPECIFIED;
    }


    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }
}
